from .import bp_apiorder
from db_connect import ConnMysqlSlave
from db_connect import ConnMysql
import aiomysql
from .methods import Order
from sanic import response
from db_connect.datetimes import DateEncoder

@bp_apiorder.route('/history')
async def add_product_info(request):

    form_info = request.args
    #以get方式
    user_id = form_info.get('user_id')
    merchat_id = form_info.get('merchat_id')

    result = await Order(user_id, merchat_id).result()
    print(result)
    return response.json(result,cls = DateEncoder)